package com.daydayup.learn;


import java.util.concurrent.ConcurrentHashMap;

/**
 * 字符翻转
 */
public class StringReverse {
    public static void main(String[] args) {
        char[] arr = new char[]{'h','e','l','l','o'};
        System.out.println(reverse(arr));
    }

    static char[] reverse(char[] arr){
        ConcurrentHashMap<String, String> hashMap = new ConcurrentHashMap<>();
        hashMap.put("1", "2");
        int left = 0;
        int right = arr.length - 1;
        while (left < right) {
            char temp = arr[left];
            arr[left] = arr[right];
            arr[right] = temp;

            left++;
            right--;
        }
        return arr;
    }
}
